﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HighDivePrinter.Model;
using HighDivePrinter.View;


namespace HighDivePrinter.Presenter
{
    public class PresenterFormContest
    {
        #region Fields/Variables
        #endregion

        #region Properties
        public IFormContest _viewContest { get; set; }
        public IContestList _contest { get; set; }

        #endregion


        #region Constructor
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="view"></param>
        /// <param name="cr"></param>
        /// 
        public PresenterFormContest(IFormContest viewContest, ContestList cl)
        {
            //Contest Class
            this._contest = cl;
            this._viewContest = viewContest;
            this._viewContest.SetContestList(cl.ListContest);
            this._viewContest.EventAddContest += AddContest;
            this._viewContest.EventRemoveContest += RemoveContest;
            this._viewContest.EventSaveContest += SaveContest;
            this._viewContest.EventReadContest += ReadContest;
        }

        #endregion

        //Contest class

        public void AddContest()
        {
            this._contest.AddContest(new Contest());
        }

        public void RemoveContest(int index)
        {
            this._contest.RemoveContest(index);
        }

        public void SaveContest()
        {
            this._contest.SaveContest();
        }

        public void ReadContest()
        {
            this._contest.ReadContest();
        }
    }
}
